home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / SampleSMSAMServer / StatusWindow.cp < prev    next >
Encoding:
Text File  |  1995-07-28  |  2.2 KB  |  98 lines  |  [TEXT/KAHL]

  1. /*
  2.     File:        StatusWindow.cp
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef __BLJSTANDARDINCLUDES__
  15. #include "BLJStandardIncludes.h"
  16. #endif
  17.  
  18. #ifndef __STATUSWINDOW__
  19. #include "StatusWindow.h"
  20. #endif
  21.  
  22. #ifndef __PASCALSTRING__
  23. #include "PascalString.h"
  24. #endif
  25.  
  26. #ifndef __BOVINESERVER__
  27. #include "BovineServer.h"
  28. #endif
  29.  
  30. /***********************************|****************************************/
  31.  
  32. TStatusWindow::TStatusWindow ( short dialogID, short stringsSTRPoundID, GetLoadIndicatorFunc loadIndicatorFunc ) :
  33.     TDialogWindow ( dialogID, stringsSTRPoundID )
  34. {
  35.     fGetLoadIndicatorValueFunc = loadIndicatorFunc;
  36. }
  37.  
  38. /***********************************|****************************************/
  39.  
  40. TStatusWindow::~TStatusWindow ( )
  41. {
  42. }
  43.  
  44. /***********************************|****************************************/
  45.  
  46. void TStatusWindow::HandleButtonPress ( short whichButton )
  47. {
  48.     switch ( whichButton )
  49.     {
  50.         case 1:        //    "Pause/Resume" button
  51.             SetGatewayPausing ( ! IsGatewayPausing ( ) );
  52.             break;
  53.     }
  54. }
  55.  
  56. /***********************************|****************************************/
  57.  
  58. Boolean TStatusWindow::UpdateLoadIndicator ( )
  59. {
  60.     SetPort ( fDialogWindow );
  61.     DrawUserItem ( 1 );
  62.     
  63.     return true;
  64. }
  65.  
  66. /***********************************|****************************************/
  67.  
  68. void TStatusWindow::DrawUserItem ( short whichItem )
  69. {
  70.     if ( whichItem == 1 )
  71.     {
  72.         unsigned long loadIndicator = (fGetLoadIndicatorValueFunc) ( );
  73.         
  74.         if ( loadIndicator < 0 )
  75.             loadIndicator = 0;
  76.         else if ( loadIndicator > 100 )
  77.             loadIndicator = 100;
  78.         
  79.         Rect totalRect = fUserItemRect [ whichItem ];
  80.         Rect filledRect = totalRect;
  81.         Rect emptyRect = totalRect;
  82.         
  83.         PenNormal();
  84.         
  85.         filledRect.right = (short) ( ( filledRect.right - filledRect.left ) * loadIndicator ) / 100 + filledRect.left;
  86.         FillRect ( & filledRect, (ConstPatternParam) & qd.black );
  87.  
  88.         emptyRect.left = filledRect.right;
  89.         FrameRect ( & emptyRect );        
  90.         
  91.         InsetRect ( & emptyRect, 1, 1 );
  92.         FillRect ( & emptyRect, (ConstPatternParam) & qd.white );
  93.     }
  94. }
  95.  
  96. /***********************************|****************************************/
  97.  
  98.